#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author   : Moty
# @Time     : 2024/10/18 22:39
# @File     : kc16_42.py
# @Project  : CSPT
def parse_42_Remote_Account_Balance_Update(body):
    # 解析0x42 远程账户余额更新
    data = {
        "桩编号": f"{body[0:14]}({body[0:14]})",
        "枪号": f"{int(body[14:16], 16)}枪({body[14:16]})",
        "物理卡号": f"{body[24:32]}({body[16:32]})",
        "修改后账户金额": f"{int.from_bytes(bytes.fromhex(body[32:40]), byteorder='little') / 100}({body[32:40]})",
    }
    formatted_data = ""
    for key, value in data.items():
        formatted_data += f"{key}: {value}\n"
    return formatted_data


__all__ = ['parse_42_Remote_Account_Balance_Update']